class_name EntityStateAnim_AdditionalEffect_CloseArea2DDetect
extends EntityStateAnim_AdditionalEffect

#region 属性
@export var detector_id:int
@export var is_clear:bool
@export var is_unactive_area:bool
@export var is_remove_callback:bool
@export var open_area2d_detect_effect_idx:int
#endregion
#region 字段
#endregion
#region 信号
#endregion

#region 基类方法
func init_additional_effect(entity_state:EntityState):
	super.init_additional_effect(entity_state)
func excute():
	super.excute()
	var reses:Array[Util.AddCallMethodTrackRes] = []
	var component:Area2DDetectComponent = entity.get_component_by_name("Area2DDetectComponent")
	if component:
		component = component as Area2DDetectComponent
		var detector:Area2DDetector = component.get_detector(detector_id)
		if detector:
			if is_clear:
				detector.clear_detect_target_dict()
			if is_unactive_area:
				detector.set_area2d_active(false)
			if is_remove_callback:
				var open_effect = entity_state.get_additional_effect_by_idx(open_area2d_detect_effect_idx)
				if open_effect and open_effect is EntityStateAnim_AdditionalEffect_OpenArea2DDetect:
					detector.set_on_detect_target(open_effect.get_detect_callable(),false)
			detector.set_active(false)
	return reses
#endregion
#region 公共方法
#endregion
#region 私有方法
#endregion
#region 生命周期函数
#endregion
